package com.coocaa.ops.common.core.base.validator;

import org.springframework.util.Assert;

/**
 * @author bijiahao
 * @date : 2019/6/20.
 * @description 参数校验器
 */
public class MyValidators {
    /**
     * 校验资源ID-类型
     *
     * @param id
     * @param type
     */
    public static void validIdAndType(String id, String type) {
        Assert.hasText(id, "resource id cannot be empty!");
        Assert.hasText(type, "resource version cannot be empty!");
    }

    public static void validIdAndType(Integer id, String type) {
        Assert.notNull(id, "resource id cannot be empty!");
        Assert.hasText(type, "resource version cannot be empty!");
    }

    public static boolean isCoocaaPrefix(Integer id) {
        String idStr = id.toString();
        if (idStr.startsWith("10")) {
            return true;
        }
        return false;
    }
}
